/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-03-03
 * Time: 12:41
 */
public class test3 {
    /**
     * LeetCode 26  删除有序数组中的重复项
     */

    public int removeDuplicates(int[] nums) {
        int n = nums.length;
        if(n==0){
            return 0;
        }
        int left = 1;
        int right = 1;
        while(right<n){
            if(nums[right]!=nums[right-1]){
                nums[left] = nums[right];
                left++;
            }
            right++;
        }
        return left;
    }
}
